// check integer
owl_byte owl_check_wchar_ascii(owl_wchar ch)
{
  if (ch >= OWL_MIN_ASCII && ch <= OWL_MAX_ASCII)
    return 1;
  return 0;
}

// check encoded
owl_byte owl_check_wchar_enc_ascii(owl_byte * src, owl_umax size)
{
  // check params
  if (owl_check_ptr(src, size) == owl_false || owl_check_wchar_ascii((owl_wchar) *src) == 0)
    return 0;
  return 1;
}

// get integer
owl_wchar owl_get_wchar_ascii(owl_byte * src, owl_umax size)
{
  // check params
  if (owl_check_wchar_enc_ascii(src, size) == 0)
    return OWL_INV_ASCII;
  return (owl_wchar) *src;
}

// write encoded
owl_byte * owl_write_wchar_enc_ascii(owl_wchar ch, owl_byte * dest, owl_umax size)
{
  // check params
  if (owl_check_wchar_ascii(ch) == 0 || owl_check_ptr(dest, size) == owl_false)
    return NULL;
  *dest = ch;
  return dest + 1;
}

// print integer
owl_byte owl_print_wchar_ascii(owl_wchar ch)
{
  // check params
  if (owl_check_wchar_ascii(ch) == 0) {
    printf(OWL_INV_ASCII_STR);
    return 0;
  }
  printf("%02llX", ch);
  return 1;
}

// print encoded
owl_byte owl_print_wchar_enc_ascii(owl_byte * src, owl_umax size)
{
  // check params
  if (owl_check_wchar_enc_ascii(src, size) == 0) {
    printf(OWL_INV_ENC_ASCII_STR);
    return 0;
  }
  printf("%02X", *src);
  return 1;
}
